//package cc.magicjson.example.demo.openapi;
//
//import org.springframework.context.annotation.Configuration;
//import org.springframework.core.io.ClassPathResource;
//import org.springframework.core.io.Resource;
//import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
//import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
//import org.springframework.web.servlet.resource.ResourceResolver;
//import org.springframework.web.servlet.resource.ResourceResolverChain;
//
//import jakarta.servlet.http.HttpServletRequest;
//import java.util.List;
//
//@Configuration
//public class SwaggerConfig implements WebMvcConfigurer {
//
//    @Override
//    public void addResourceHandlers(ResourceHandlerRegistry registry) {
//        registry.addResourceHandler("/swagger-ui-config.json")
//                .addResourceLocations("classpath:/static/")
//                .resourceChain(false)
//                .addResolver(new SwaggerResourceResolver());
//    }
//
//    private static class SwaggerResourceResolver implements ResourceResolver {
//        @Override
//        public Resource resolveResource(HttpServletRequest request, String requestPath, List<? extends Resource> locations, ResourceResolverChain chain) {
//            return requestPath.equals("swagger-ui-config.json") ? new ClassPathResource("static/swagger-ui-config.json") : null;
//        }
//
//        @Override
//        public String resolveUrlPath(String resourcePath, List<? extends Resource> locations, ResourceResolverChain chain) {
//            return resourcePath.equals("swagger-ui-config.json") ? resourcePath : null;
//        }
//    }
//}